<template>
  <div class='search'>
    <f-drawer ref='details' title='采购详情' width='80%' @visibleChange='visibleChange'>
      <procure-details ref='form1' v-if='drawerVisible' style='margin-bottom: 50px'></procure-details>
    </f-drawer>
  </div>
</template>
<script>


import ProcureDetails from "./procure_details"

export default {
  name: "ProcureDetailsDrawer",
  props: {},
  data() {
    return {
      refs: this.$refs,
      drawerVisible: false,
      isEdit: false,
      title: "",
      current: "form1",
      formData: {},
      forms: [
        "form1"
      ]
    }
  },
  methods: {
    showDrawer(data) {
      this.isEdit = false
      if (data && data.procureNo) {
        this.isEdit = true
        this.formData = data
      } else {
        this.formData = {}
      }
      this.refs["details"].show()
      this.tabClick("form1")
    },
    visibleChange(drawerVisible) {
      this.drawerVisible = drawerVisible
    },
    tabClick(name) {
      this.current = name
      this.$nextTick(() => {
        this.refs[this.current].setData(this.formData)
      })
    }
  },
  computed: {
    drawerTitle: function() {
      return this.title
    }
  },
  created() {
  },
  components: { ProcureDetails }
}
</script>

<style scoped lang='less' rel='stylesheet/less'>

</style>
